package cn.taokuaidi.wangwang.client.widget.form;

import cn.taokuaidi.wangwang.client.constants.AppEvents;
import cn.taokuaidi.wangwang.client.widget.BaseEventCenter;

import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Dispatcher;
import com.extjs.gxt.ui.client.widget.Window;

/**
 * @author 嘉陵江里捉鱼 email:tang7259@163.com
 *@version 1.0
 *@time Nov 3, 2008 11:25:29 AM
 */
public abstract class TkdForm extends Window {

    public TkdForm() {
        Dispatcher.get().addController(new BaseEventCenter() {

            @Override
            public void handleEvent(AppEvent<?> event) {
                if (event.type == AppEvents.ALL_AGENT_LOADED) {
                    loadAgentData();
                }
                if (event.type == AppEvents.SELLER_GRID_SELECTED) {
                    loadOrder();
                }
                if (event.type == AppEvents.BUYER_GRID_SELECTED) {
                    loadOrder();
                }
            }
        });
    }

    public abstract void loadAgentData();

    public abstract void loadOrder();
}
